#include "../../include/Chassis.h"

Chassis::Chassis():Component(CHASSIS)
{
}

Chassis::~Chassis()
{
}

string Chassis::getInfo() {
    return "";
}

#include <iostream>
void Chassis::doAsCommend(string cmd) {
    int idx = cmd.find(':');
    string carName = cmd.substr(0,idx);
    string subCmd = cmd.substr(idx+1);
    idx = subCmd.find(':');
    string controlCmd = subCmd.substr(0,idx);
    string controlData = subCmd.substr(idx+1);

    if(controlCmd == TO_BACK) {
        cout << "小车倒车" << endl;
    }
    else if(controlCmd == TO_LEFT) {
        cout << "小车左转" << endl;
    }
    else if(controlCmd == TO_RIGHT) {
        cout << "小车右转" << endl;
    }
    else {
        cout << "小车静止" << endl;
    }
}
